package com.octopus.kernal.controller;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.octopus.kernal.model.BaseStruct;

public abstract class AbstractCustomizedController<T extends BaseStruct, S extends AbstractSearchCommand<T>, PK extends Serializable> implements ControllerInterface<T, S, PK>{
    
    @RequestMapping(value = "/query.o", method = RequestMethod.GET)
    public String back(Model model, HttpServletRequest request, S searchCommand){
    	String offset = request.getParameter("pager.offset");
    	if(StringUtils.isBlank(offset))
    		return "redirect:../query.o";
    	else
    		return "redirect:../query.o?pager.offset=" + offset;
    }

	@Override
	public String query(Model model, HttpServletRequest request, S searchCommand) {
		return null;
	}

	@Override
	public String search(Model model, HttpServletRequest request,
			S searchCommand) {
		return null;
	}

	@Override
	public String create(Model model, HttpServletRequest request, T entity) {
		return null;
	}

	@Override
	public String saveCreate(Model model, HttpServletRequest request, T entity,
			BindingResult errors) {
		return null;
	}

	@Override
	public String edit(Model model, HttpServletRequest request, PK id, T entity) {
		return null;
	}

	@Override
	public String saveEdit(Model model, HttpServletRequest request, PK id,
			T entity, BindingResult errors) {
		return null;
	}

	@Override
	public String view(Model model, HttpServletRequest request, PK id, T entity) {
		return null;
	}

	@Override
	public String delete(Model model, HttpServletRequest request, PK id) {
		return null;
	}

}
